﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Management;
using System.Text;
using WMI.NET.Abstracts;

namespace WMI.NET.OperatingSystem.Users
{
    /// <summary>
    /// The Win32_Group WMI class represents data about a group account. A group account allows access privileges to be changed for a list of users. Example: Marketing2.
    /// </summary>
    public class Win32_Group : Win32_Account
    {

        /// <summary>
        /// The Rename WMI class method allows the group name to be changed. 
        /// </summary>
        /// <param name="Name">Name of the Windows user account on the domain specified by the Domain property of this class.</param>
        /// <returns></returns>
        public UInt32 Rename(string Name) { throw new NotImplementedException(); } //TODO enum

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mbo"></param>
        public Win32_Group(ManagementBaseObject mbo)
            : base(mbo)
        {

        }


    }


    /// <summary>
    /// 
    /// </summary>
    public class GetWin32_Groups : Win32Collection<Win32_Group>
    {

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override ReadOnlyCollection<Win32_Group> GetCollection()
        {
            List<Win32_Group> tempCollection = new List<Win32_Group>();

            foreach (var s in searcher.Get())
            {
                Win32_Group tempListItem = new Win32_Group(s);
                tempCollection.Add(tempListItem);
            }

            return tempCollection.AsReadOnly();
        }

        /// <summary>
        /// 
        /// </summary>
        public GetWin32_Groups() : base("SELECT * FROM Win32_Group") { }

    }

}
